package com.irdstudio.apicenter.console.controller;

import java.util.HashMap;
import java.util.Map;

import com.irdstudio.apicenter.frame.core.jdbc.container.DataList;
import com.irdstudio.apicenter.frame.core.jdbc.container.PageInfo;
import com.irdstudio.apicenter.frame.core.jdbc.container.UniKeyValueObject;

/**
 * Macms上下文对象
 * 
 * @author guangming.li
 * @version 1.0
 * @date 2015-06-25
 */
public class MacmsContext {

	/* 所有接收到的参数 */
	private UniKeyValueObject uvo = null;

	/* 数据集容器 */
	private Map<String, DataList> dataLists = new HashMap<String, DataList>();

	/* 分页信息容器 */
	private Map<String, PageInfo> pageInfos = new HashMap<String, PageInfo>();

	/**
	 * 放入所有接收到的参数
	 * 
	 * @param uvo
	 */
	public void setRequestParams(UniKeyValueObject uvo) {
		this.uvo = uvo;
	}

	/**
	 * 返回参数集合对象
	 * 
	 * @return
	 */
	public UniKeyValueObject getRequestParams() {
		return this.uvo;
	}

	/**
	 * 增加一个数据集到上下文中
	 * 
	 * @param dataListName
	 * @param findMapList
	 */
	public void addDataList(String dataListName, DataList dataList) {
		dataLists.put(dataListName, dataList);
	}

	/**
	 * 增加分页信息到上下文中
	 * 
	 * @param dataListName
	 * @param pageInfo
	 */
	public void addPageInfo(String dataListName, PageInfo pageInfo) {
		pageInfos.put(dataListName, pageInfo);
	}

	/**
	 * 获取数据集对象
	 * 
	 * @param string
	 * @return
	 */
	public DataList getDataList(String dataListName) {
		return dataLists.get(dataListName);
	}

	/**
	 * 获取分页信息
	 * 
	 * @param dataListName
	 * @return
	 */
	public PageInfo getPageInfo(String dataListName) {
		return pageInfos.get(dataListName);
	}

}
